package cn.zhuo.knowledge.util.hutool.bean;

import cn.hutool.core.bean.BeanUtil;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Map;

/**
 * <p>
 *
 * @author z2huo
 */
class BeanUtilGetPropertyTest {

    public static void main(String[] args) {

        Map<String, String> map = Map.of(
                "name", "zyz",
                "age", "18"
        );
        Object age = BeanUtil.getProperty(map, "age");
        System.out.println(age);

        User user = new User().setAge(18).setName("zyz");
        Object userAge = BeanUtil.getProperty(user, "age");
        System.out.println(userAge);
    }

    @Data
    @Accessors(chain = true)
    private static class User {

        private String name;

        private Integer age;
    }

}
